package service.oss.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import service.edu.result.R;
import service.oss.service.OssService;

@RestController
@RequestMapping("/oss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    //上传头像
    @PostMapping("/uploadOssFile")
    public R uploadOssFile(MultipartFile file){
        //获取上传文件路径
        String url = ossService.uploadFileAvatar(file);
        return R.Ok().data("url", url);
    }

}
